home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_Binary / iparserhooks.m < prev    next >
Text File  |  1992-12-19  |  4KB  |  318 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34. *    iparserhooks.m
  35.  *
  36.  *    Version:    2.0
  37.  *    Author:    Ken Fromm
  38.  *    History:
  39.  *            03-07-91        Added this comment.
  40. */
  41.  
  42. #import "iinterpreter.h"
  43. #import "iinterpreterhooks.h"
  44. #import "Graphic.h"
  45. #import <dpsclient/dpsclient.h>
  46. #import <stdio.h>
  47.  
  48. extern char        yytext[];
  49. extern int            yyleng;
  50.  
  51. void i_int()
  52. {
  53.     int    avalue;
  54.  
  55.     sscanf(yytext,"%d", &avalue);
  56.     ipushint(avalue);
  57. }
  58.  
  59. void i_real()
  60. {
  61.     float     avalue;
  62.  
  63.     sscanf(yytext,"%f", &avalue);
  64.     ipushreal(avalue);
  65. }
  66.  
  67. /* Omit the preceding slash. */
  68. void i_literal()
  69. {
  70.     ipushname(&yytext[1], yyleng-1);
  71. }
  72.  
  73. void i_name()
  74. {
  75.     printf("%s\n", yytext);
  76. }
  77.  
  78. void i_array()
  79. {
  80. }
  81.  
  82. /* Disregard the open and close parens. */
  83. void i_string()
  84. {
  85.     ipushstring(&yytext[1], yyleng-2);        
  86. }
  87.  
  88. void i_f()
  89. {
  90.     iinsertPath(FILL);
  91. }
  92.  
  93. void i_s()
  94. {
  95.     iinsertPath(STROKE);
  96. }
  97.  
  98. void i_clip()
  99. {
  100.     iinsertPath(CLIP);
  101. }
  102.  
  103. void i_T()
  104. {
  105.     iclear();
  106. }
  107.  
  108. void i_A()
  109. {
  110.     iclear();
  111. }
  112.  
  113. void i_W()
  114. {
  115.     iclear();
  116. }
  117.  
  118. void i_AW()
  119. {
  120.     iclear();
  121. }
  122.  
  123. void i_m()
  124. {
  125.     iinsertPathOp(dps_moveto,2);
  126. }
  127.  
  128. void i_lineto()
  129. {
  130.     iinsertPathOp(dps_lineto,2);
  131. }
  132.  
  133. void i_L()
  134. {
  135.     int        i, index;
  136.  
  137.     ipopint(&index);
  138.     for (i = index; i > 0; i--)
  139.         iinsertPathOp(dps_lineto,2);
  140. }
  141.  
  142. void i_r()
  143. {
  144.     iinsertPathOp(dps_rlineto,2);
  145. }
  146.  
  147. void i_R()
  148. {
  149.     int        i, index;
  150.  
  151.     ipopint(&index);
  152.     for (i = index; i > 0; i--)
  153.         iinsertPathOp(dps_rlineto,2);
  154. }
  155.  
  156. void i_l()
  157. {
  158.     iinsertPathOp(dps_moveto,2);
  159.     iinsertPathOp(dps_lineto,2);
  160.     iinsertPath(STROKE);
  161. }
  162.  
  163. void i_x()
  164. {
  165.     ipushreal(0.0);
  166.     iinsertPathOp(dps_rlineto,2);
  167. }
  168.  
  169. void i_y()
  170. {
  171.     ipushreal(0.0);
  172.     iroll(2,1);
  173.     iinsertPathOp(dps_rlineto,2);
  174. }
  175.  
  176. void i_X()
  177. {
  178.     iinsertPathOp(dps_moveto,2);
  179.     ipushreal(0.0);
  180.     iinsertPathOp(dps_rlineto,2);
  181.     iinsertPath(STROKE);
  182. }
  183.  
  184. void i_Y()
  185. {
  186.     iinsertPathOp(dps_moveto,2);
  187.     ipushreal(0.0);
  188.     iroll(2,1);
  189.     iinsertPathOp(dps_rlineto,2);
  190.     iinsertPath(STROKE);
  191. }
  192.  
  193. void i_c()
  194. {
  195.     iinsertPathOp(dps_curveto,6);
  196. }
  197.  
  198. void i_cp()
  199. {
  200.     iinsertPathOp(dps_closepath,0);
  201. }
  202.  
  203. void i_w()
  204. {
  205.     float        avalue;
  206.     
  207.     ipopreal(&avalue);
  208.     ii_setlinewidth(avalue);
  209. }
  210.  
  211. void i_g()
  212. {
  213.     float        avalue;
  214.     
  215.     ipopreal(&avalue);
  216.     ii_setgray(avalue);
  217. }
  218.  
  219. void i_j()
  220. {
  221.     int        avalue;
  222.     
  223.     ipopint(&avalue);
  224.     ii_setlinejoin(avalue);
  225. }
  226.  
  227. void i_d()
  228. {
  229.     /* setdash not implemented */
  230.     iclear();
  231. }
  232.  
  233. void i_miter()
  234. {
  235.     float        avalue;
  236.     
  237.     ipopreal(&avalue);
  238.     ii_setmiterlimit(avalue);
  239. }
  240.  
  241. void i_cap()
  242. {
  243.     float        avalue;
  244.     
  245.     ipopreal(&avalue);
  246.     ii_setlinecap(avalue);
  247. }
  248.  
  249. void i_RGB()
  250. {
  251.     float        r, g, b;
  252.     
  253.     ipopreal(&b);
  254.     ipopreal(&g);
  255.     ipopreal(&r);
  256.     ii_setrgbcolor(r, g, b);
  257. }
  258.  
  259. void i_F()
  260. {
  261.     /*  setfont not implemented */
  262.     iclear();
  263. }
  264.  
  265. void i_MF()
  266. {
  267.     /*  makefont not implemented */
  268.     iclear();
  269. }
  270.  
  271. void i_FF()
  272. {
  273.     /*  setfont not implemented */
  274.     iclear();
  275. }
  276.  
  277. void i_DF()
  278. {
  279.     /*  definefont not implemented */
  280.     iclear();
  281. }
  282.  
  283. void i_IMASK()
  284. {
  285.     /*  imagemask not implemented */
  286.     iclear();
  287. }
  288.  
  289. void i_IMAGE()
  290. {
  291.     /*  image not implemented */
  292.     iclear();
  293. }
  294.  
  295. void i_BPAGE()
  296. {
  297.     ipop();
  298. }
  299.  
  300. void i_EPAGE()
  301. {
  302.     int    page_num;
  303.     
  304.     ipopint(&page_num);
  305.     iinsertPage(page_num);
  306. }
  307.  
  308. void i_REMAP()
  309. {
  310.     iclear();
  311. }
  312.  
  313. void i_RECODE()
  314. {
  315.     iclear();
  316. }
  317.  
  318.